<template>
  <el-drawer title="内容详情" :visible.sync="drawer" direction="rtl" :before-close="beforeClose">
    <div class="title">
      <img :src="detail.cover" style="width: 50px; height: 50px" />
      <div class="tit">{{ detail.title }}</div>
    </div>

    <div class="authorName">创建人： {{ detail.authorName }}</div>

    <div class="authorName">创建时间： {{ detail.createTime }}</div>

    

    <div class="label">搭配图片</div>

    <div class="imgVue">
      <div class="li" v-for="(item, index) in detail.extraGroups" :key="index">
        <div class="imgs">
          <div class="img" v-for="(o, i) in item.images" :key="i">
            <img :src="o" style="width: 100%; height: 100%; border-radius: 4px" />
          </div>
        </div>
        <div class="products">
            <div class="product" v-for="(o, i) in item.products" :key="i">
                <img :src="o.image" style="width: 100px; height: 100px;">
                <div class="info">
                    <div class="name">{{  o.name }}</div>
                    <div class="intro">{{  o.intro }}</div>
                    <div class="price">￥{{  o.price  }}</div>
                </div>
            </div>
        </div>
      </div>
    </div>
  </el-drawer>
</template>

<script>
import { officialDetailt } from '@/api/creation';
export default {
  props: {
    drawer: {
      type: Boolean,
      default: false,
    },
  },
  data() {
    return {
      detail: {
        cover: '',
        title: '',
      },
    };
  },
  methods: {
    getDetail(id) {
      officialDetailt(id).then((res) => {
        console.log(res);
        this.detail = res;
      });
    },
    beforeClose() {
      this.$emit('beforeClose');
    },
  },
};
</script>

<style lang="scss">
.title {
  display: flex;
  align-items: center;
  padding: 0 20px;
  .tit {
    padding-left: 10px;
    color: #333;
    font-weight: 600;
    font-size: 16px;
  }
}

.authorName {
  color: #999;
  font-size: 16px;
  padding: 15px 20px;
  line-height: 1;
}

.label {
  padding: 20px 20px 0;
  color: #333;
  font-weight: 600;
  font-size: 16px;
}

.imgVue {
  width: 100%;
  padding: 20px;

  .li {
    width: 100%;
    background: #f5f5f5;
    margin-top: 20px;
    border-radius: 4px;
    .imgs {
      width: 100%;
      display: flex;
      flex-wrap: wrap;
      padding: 10px;
      .img {
        width: 100px;
        height: 100px;
        margin-right: 20px;
        margin-top: 20px;
      }
    }
    .products {
        width: 100%;
        background: #f5f5f5;
        padding: 10px;
        .product {
            width: 100%;
            height: 120px;
            background: #fff;
            padding: 10px;
            margin-top: 10px;
            display: flex;
            align-items: center;
            border-radius: 4px;
            .info {
                flex: 1;
                height: 100px;
                padding-left: 10px;
                display: flex;
                justify-content: space-between;
                flex-direction: column;
                .name {
                    color: #333;
                    font-weight: 600;
                    font-size: 16px;
                }
                .intro {
                    color: #999;
                    font-size: 16px;
                }
                .price {
                    font-weight: 600;
                    font-size: 16px;
                    color: #d81e06;
                }
            }
        }
    }
  }
}
</style>